Skip to content

Conversation

@Renaud-K
Copy link
Contributor

@Renaud-K Renaud-K commented Feb 4, 2025

I thought I had added tests together with #125276
But there are still in my sandbox. These are the tests that were meant for this PR.

@Renaud-K Renaud-K requested a review from clementval February 4, 2025 20:34
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:fir-hlfir labels Feb 4, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 4, 2025

@llvm/pr-subscribers-flang-fir-hlfir

Author: Renaud Kauffmann (Renaud-K)

Changes

I thought I had added tests together with #125276
But there are still in my sandbox. These are the tests that were meant for this PR.


Full diff: https://github.com/llvm/llvm-project/pull/125755.diff

1 Files Affected:

  • (modified) flang/test/Lower/CUDA/cuda-intrinsic.cuf (+183-6)
diff --git a/flang/test/Lower/CUDA/cuda-intrinsic.cuf b/flang/test/Lower/CUDA/cuda-intrinsic.cuf
index 9723afc532387f4..77682ad7139a782 100644
--- a/flang/test/Lower/CUDA/cuda-intrinsic.cuf
+++ b/flang/test/Lower/CUDA/cuda-intrinsic.cuf
@@ -1,17 +1,194 @@
 ! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s
 
 module mod1
-  type int
-    real :: inf, sup 
-  end type int
+  type retf
+    real :: inf, sup, near, zero 
+  end type retf
+  type retd
+    real(8) :: inf, sup, near, zero 
+  end type retd
 contains
   attributes(global) subroutine fadd(c, a, b)
-    type (int) :: c, a, b
-    c%inf = __fadd_rd(a%inf, b%inf)
-    c%sup = __fadd_ru(a%sup, b%sup)
+    real(4) :: a, b
+    type (retf) :: c
+    c%near = __fadd_rn(a, b)
+    c%zero = __fadd_rz(a, b)
+    c%inf =  __fadd_rd(a, b)
+    c%sup =  __fadd_ru(a, b)
   end subroutine
+  attributes(global) subroutine dadd(c, a, b)
+    real(8) :: a, b
+    type (retd) :: c
+    c%near = __dadd_rn(a, b)
+    c%zero = __dadd_rz(a, b)
+    c%inf =  __dadd_rd(a, b)
+    c%sup =  __dadd_ru(a, b)
+  end subroutine
+  attributes(global) subroutine fmul(c, a, b)
+    real(4) :: a, b
+    type (retf) :: c
+    c%near = __fmul_rn(a, b)
+    c%zero = __fmul_rz(a, b)
+    c%inf  = __fmul_rd(a, b)
+    c%sup  = __fmul_ru(a, b)
+  end subroutine
+  attributes(global) subroutine dmul(c, a, b)
+    real(8) :: a, b
+    type (retf) :: c
+    c%near = __dmul_rn(a, b)
+    c%zero = __dmul_rz(a, b)
+    c%inf  = __dmul_rd(a, b)
+    c%sup  = __dmul_ru(a, b)
+  end subroutine
+  attributes(global) subroutine fmaf(c, a, b)
+    real(4) :: a, b
+    type (retf) :: c
+    c%near = __fmaf_rn(a, b, b)
+    c%zero = __fmaf_rz(a, b, b)
+    c%inf  = __fmaf_rd(a, b, b)
+    c%sup  = __fmaf_ru(a, b, b)
+  end subroutine
+  attributes(global) subroutine fma(c, a, b)
+    real(8) :: a, b
+    type (retd) :: c
+    c%near = __fma_rn(a, b, b)
+    c%zero = __fma_rz(a, b, b)
+    c%inf  = __fma_rd(a, b, b)
+    c%sup  = __fma_ru(a, b, b)
+  end subroutine
+  attributes(global) subroutine frcp(c,a)
+    real(4) :: a
+    type (retf) :: c
+    c%near = __frcp_rn(a)
+    c%zero = __frcp_rz(a)
+    c%inf  = __frcp_rd(a)
+    c%sup  = __frcp_ru(a)
+  end subroutine
+  attributes(global) subroutine fsqrt(c,a)
+    real(4) :: a
+    type (retf) :: c
+    c%near = __fsqrt_rn(a)
+    c%zero = __fsqrt_rz(a)
+    c%inf  = __fsqrt_rd(a)
+    c%sup  = __fsqrt_ru(a)
+  end subroutine
+  attributes(global) subroutine fdiv(c, a, b)
+    real(4) :: a, b
+    type (retf) :: c
+    c%near = __fdiv_rn(a, b)
+    c%zero = __fdiv_rz(a, b)
+    c%inf  = __fdiv_rd(a, b)
+    c%sup  = __fdiv_ru(a, b)
+  end subroutine
+  attributes(global) subroutine testsincosf(c, a, b)
+    real(4) :: a, b, c
+    call sincos(a, b, c)
+  end subroutine
+  attributes(global) subroutine testsincosd(c, a, b)
+    real(8) :: a, b, c
+    call sincos(a, b, c)
+  end subroutine
+  attributes(global) subroutine testsincospif(c, a, b)
+    real(4) :: a, b, c
+    call sincospi(a, b, c)
+  end subroutine
+  attributes(global) subroutine testsincospid(c, a, b)
+    real(8) :: a, b, c
+    call sincospi(a, b, c)
+  end subroutine
+  attributes(global) subroutine testmulhi(c, a, b)
+    integer(4) :: a, b, c
+    c = __mulhi(a, b)
+  end subroutine
+  attributes(global) subroutine testumulhi(c, a, b)
+    integer(4) :: a, b, c
+    c = __umulhi(a, b)
+  end subroutine
+  attributes(global) subroutine testmul64hi(c, a, b)
+    integer(8) :: a, b, c
+    c = __mul64hi(a, b)
+  end subroutine
+  attributes(global) subroutine testumul64hi(c, a, b)
+    integer(8) :: a, b, c
+    c = __umul64hi(a, b)
+  end subroutine
+
 end
 
 ! CHECK-LABEL: func.func @_QMmod1Pfadd
+! CHECK: fir.call @__nv_fadd_rn
+! CHECK: fir.call @__nv_fadd_rz
 ! CHECK: fir.call @__nv_fadd_rd
 ! CHECK: fir.call @__nv_fadd_ru
+
+! CHECK-LABEL: func.func @_QMmod1Pdadd
+! CHECK: fir.call @__nv_dadd_rn
+! CHECK: fir.call @__nv_dadd_rz
+! CHECK: fir.call @__nv_dadd_rd
+! CHECK: fir.call @__nv_dadd_ru
+
+! CHECK-LABEL: func.func @_QMmod1Pfmul
+! CHECK: fir.call @__nv_fmul_rn
+! CHECK: fir.call @__nv_fmul_rz
+! CHECK: fir.call @__nv_fmul_rd
+! CHECK: fir.call @__nv_fmul_ru
+
+! CHECK-LABEL: func.func @_QMmod1Pdmul
+! CHECK: fir.call @__nv_dmul_rn
+! CHECK: fir.call @__nv_dmul_rz
+! CHECK: fir.call @__nv_dmul_rd
+! CHECK: fir.call @__nv_dmul_ru
+
+! CHECK-LABEL: func.func @_QMmod1Pfmaf
+! CHECK: fir.call @__nv_fmaf_rn
+! CHECK: fir.call @__nv_fmaf_rz
+! CHECK: fir.call @__nv_fmaf_rd
+! CHECK: fir.call @__nv_fmaf_ru
+
+! CHECK-LABEL: func.func @_QMmod1Pfma
+! CHECK: fir.call @__nv_fma_rn
+! CHECK: fir.call @__nv_fma_rz
+! CHECK: fir.call @__nv_fma_rd
+! CHECK: fir.call @__nv_fma_ru
+
+! CHECK-LABEL: func.func @_QMmod1Pfrcp
+! CHECK: fir.call @__nv_frcp_rn
+! CHECK: fir.call @__nv_frcp_rz
+! CHECK: fir.call @__nv_frcp_rd
+! CHECK: fir.call @__nv_frcp_ru
+
+! CHECK-LABEL: func.func @_QMmod1Pfsqrt
+! CHECK: fir.call @__nv_fsqrt_rn
+! CHECK: fir.call @__nv_fsqrt_rz
+! CHECK: fir.call @__nv_fsqrt_rd
+! CHECK: fir.call @__nv_fsqrt_ru
+
+! CHECK-LABEL: func.func @_QMmod1Pfdiv
+! CHECK: fir.call @__nv_fdiv_rn
+! CHECK: fir.call @__nv_fdiv_rz
+! CHECK: fir.call @__nv_fdiv_rd
+! CHECK: fir.call @__nv_fdiv_ru
+
+! CHECK-LABEL: func.func @_QMmod1Ptestsincosf
+! CHECK: fir.call @__nv_sincosf
+
+! CHECK-LABEL: func.func @_QMmod1Ptestsincosd
+! CHECK: fir.call @__nv_sincos
+
+! CHECK-LABEL: func.func @_QMmod1Ptestsincospif
+! CHECK: fir.call @__nv_sincospif
+
+! CHECK-LABEL: func.func @_QMmod1Ptestsincospid
+! CHECK: fir.call @__nv_sincospi
+
+! CHECK-LABEL: func.func @_QMmod1Ptestmulhi
+! CHECK: fir.call @__nv_mulhi
+
+! CHECK-LABEL: func.func @_QMmod1Ptestumulhi
+! CHECK: fir.call @__nv_umulhi
+
+! CHECK-LABEL: func.func @_QMmod1Ptestmul64hi
+! CHECK: fir.call @__nv_mul64hi
+
+! CHECK-LABEL: func.func @_QMmod1Ptestumul64hi
+! CHECK: fir.call @__nv_umul64hi

@clementval clementval changed the title Adding missing tests [flang][cuda][NFC] Adding missing tests Feb 4, 2025
Copy link
Contributor

@clementval clementval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Renaud-K Renaud-K merged commit 8cc7f74 into llvm:main Feb 4, 2025
11 checks passed
Icohedron pushed a commit to Icohedron/llvm-project that referenced this pull request Feb 11, 2025
I thought I had added tests together with
llvm#125276
But there are still in my sandbox. These are the tests that were meant
for this PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flang:fir-hlfir flang Flang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants